<template>
    <div class="card">
        <van-swipe lazy-render ref="ticketSwiper">
            <template v-for="(item, index) in data" :key="item">
                <van-swipe-item v-if="item.cooperationMode">
                    <div class="title">机制{{ index == '0' ? '一' : index == '1' ? "二" : "三" }}</div>
                    <div class="mechanism">{{ item.cooperationMode }}</div>
                    <div class="content">
                        <div class="header">
                            <div class="price"><span>￥</span>{{ item.price || item.costPrice }}</div>
                            <div v-if="item.cooperationMode == '分佣'" class="commission">
                                <div class="titles">佣</div>
                                <div class="font">{{ item.commission }}%</div>
                            </div>
                        </div>
                        <div class="content_items">
                            <div class="label">发货机制：</div>
                            <div class="vlaue">{{ item.liveStreamingMechanism }}</div>
                        </div>
                        <div class="content_items">
                            <div class="label">成本：</div>
                            <div class="vlaue">{{ item.costPrice }}</div>
                        </div>
                        <div class="content_items" v-if="item.cooperationMode == '分佣'">
                            <div class="label">补充佣金：</div>
                            <div class="vlaue">{{ item.brokerage }}%</div>
                        </div>
                    </div>
                </van-swipe-item>
            </template>
        </van-swipe>
    </div>
</template>
<script setup lang="ts">
import { defineProps } from 'vue'
defineProps({ data: { type: Object, default: () => { } } })
</script>
<style lang="less" scoped>
.card {
    width: 345px;
    height: 213px;
    background: linear-gradient(90deg, #E3EBFE 0%, #CFDBFE 100%);
    border-radius: 10px;

    :deep(.van-swipe__indicator) {
        width: 20px !important;
        height: 3px !important;
        border-radius: 3px !important;
    }

    :deep(.van-swipe__indicator--active) {
        width: 20px !important;
        height: 3px !important;
        border-radius: 3px !important;
    }

    :deep(.van-swipe) {
        width: 100%;
        height: 100%;

        .title {
            width: 100%;
            box-sizing: border-box;
            padding: 10px 15px;
            font-weight: 500;
            font-size: 16px;
            color: #0094FF;
        }

        .mechanism {
            position: absolute;
            right: 0;
            top: 0;
            width: 58px;
            height: 24px;
            background: #EBF4FF;
            border-radius: 0px 10px 0px 10px;
            font-weight: 400;
            font-size: 14px;
            color: #0094FF;
            text-align: center;
            line-height: 24px;
        }

        .content {
            height: calc(100% - 42px);
            background-color: #fff;
            width: 339px;
            background: #FFFFFF;
            border-radius: 10px;
            margin: auto;
            box-sizing: border-box;
            padding: 15px 10px;

            .header {
                display: flex;
                align-items: center;
                margin-bottom: 15px;
            }

            .price {
                font-weight: 500;
                font-size: 24px;
                color: #FC2540;

                span {
                    font-size: 16px;
                }
            }

            .commission {
                margin-left: 10px;
                display: flex;
                align-items: center;

                .titles {
                    width: 22px;
                    height: 16px;
                    background: #1B1714;
                    border-radius: 2px;
                    text-align: center;
                    line-height: 16px;
                    font-weight: 400;
                    font-size: 12px;
                    color: #CEA46C;
                }

                .font {
                    min-width: 37px;
                    height: 16px;
                    background: linear-gradient(136deg, #E9D1A5 0%, #CEA46C 100%);
                    border-radius: 2px;
                    text-align: center;
                    line-height: 16px;
                    font-weight: 500;
                    font-size: 12px;
                    color: #1B1714;
                }
            }

            .content_items {
                display: flex;
                align-items: center;
                margin-bottom: 15px;

                .label {
                    width: 80px;
                    font-weight: 400;
                    font-size: 14px;
                    color: #1A1B1C;
                }

                .vlaue {
                    width: calc(100% - 70px);
                    font-weight: 500;
                    font-size: 14px;
                    color: #8492AD;
                    display: flex;
                    justify-content: flex-end;

                    // display: -webkit-box;
                    // overflow: hidden;
                    // text-overflow: ellipsis;
                    // -webkit-line-clamp: 1;
                    // -webkit-box-orient: vertical;
                }
            }
        }
    }
}
</style>